package com.jml.zlhq.app.ui;

import java.util.Map;

import android.app.Instrumentation.ActivityResult;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jml.zlhq.app.R;

public class AboutActivity extends BaseActivity {
	private TextView version;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about_activity);
		
		LinearLayout leftLay = (LinearLayout) findViewById(R.id.content_header_left_lay);
		LinearLayout rightLay = (LinearLayout) findViewById(R.id.content_header_right_lay);
		leftLay.setOnClickListener(this);
		rightLay.setOnClickListener(this);
		AutoCompleteTextView centerEdit = (AutoCompleteTextView) findViewById(R.id.content_header_center_edit);
		centerEdit.setVisibility(View.GONE);
		ImageView leftImage = (ImageView) findViewById(R.id.content_header_left_img);
		leftImage.setImageResource(R.drawable.back_selector);
		ImageView roghtImage1 = (ImageView) findViewById(R.id.content_header_right_img);
		roghtImage1.setVisibility(View.GONE);
		ImageView roghtImage2 = (ImageView) findViewById(R.id.content_header_right_img2);
		roghtImage2.setVisibility(View.INVISIBLE);
		roghtImage2.setImageResource(R.drawable.collect_selector);
		TextView centerText = (TextView) findViewById(R.id.content_header_center_text);
		centerText.setText("关于");
		TextView rightText = (TextView) findViewById(R.id.content_header_right_text);
		rightText.setVisibility(View.INVISIBLE);
		TextView cityChosed = (TextView) findViewById(R.id.content_header_center_text2);
		cityChosed.setVisibility(View.GONE);
		
		version = (TextView) findViewById(R.id.about_cuv);
		//info = (TextView) findViewById(R.id.about_info);
//		RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, UIUtil.winHight/2);
//		rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 
//		info.setLayoutParams(rlp);
		
		PackageInfo info = null;
		try {
			info = appContext.getPackageManager().getPackageInfo(appContext.getPackageName(), 0);
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		version.setText("当前版本 "+(info==null?"":info.versionName));
	}
	

	@Override
	public void loadData(Map<String, String> param) {}

	@Override
	public void clearData() {}
	
	
	
	@Override
	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.content_header_left_lay:
			finish();
			break;
		
		default:
			break;
		}
	}
	
}
